<template>
	<view class="uni_box home">
		<navbar title='道具记录'>
		</navbar>
		<view class="content">
			<view class="ztwo" v-if="list">
				<!-- <text class="shouname">收益明细</text> -->
				<view class="nlist">
					<view class="nitem" v-for="(item,index) in list" :key="index">
						<view class="none">
							<text class="name">{{item.memo}}</text>
							<text class="nprice">{{item.type}}</text>
						</view>
						<text class="time" v-if="item.reason">{{item.reason}}</text>
						<text class="time">{{item.createtime}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				list: [],
				page: 1,
				limit: 10,
				last_page: 1,
				status: "loadmore",
			}
		},
		onLoad() {
			this.getuserinfo()
			this.getList()
		},
		onShow() {
		},
		onReachBottom: function () {
			this.loadmore();
		},
		methods: {
			async getList(){//列表数据
				let res = await this.$u.api.daogetLog({
					// limit:this.limit,
					  page:this.page
				});
				this.last_page = res.lastpage;
				let list = res.list;
				this.list = this.page == 1 ? list : [...this.list, ...list];	
				if(this.page >= this.last_page){
				  this.status = 'nomore';
				}
				
			},
			loadmore() {
				let page = this.page;
				if (this.status == 'loadmore') {
					this.page++;
					this.getList();
				}
			},
			async getuserinfo(){
				let res = await this.$u.api.usergetData({
				});
				this.info = res
				// this.user = res.user
			},
			gettixian(){
				this.navrouter("/pages_subject/twoPage/Tixian");
			},
			tijilu(){
				this.navrouter("/pages_subject/twoPage/TiRecord");
			},
			getchuzhi(){
				this.navrouter("/pages_subject/twoPage/Chuzhi");
			}
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 30rpx;
		.zone{
			// margin:0 30rpx;
			height: 220rpx;
			width: 100%;
			position: relative;
			.jinbg{
				position: absolute;
				width: 100%;
				height: 100%;
			}
			.zoneview{
				position: relative;
				width: 100%;
				height: 100%;
				padding: 30rpx 30rpx;
				.syone{
					display: flex;
					flex-direction: row;
					align-items: center;
					.syname{
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 32rpx;
						color: #FFFFFF;
					}
					.yan{
						margin-left: 10rpx;
						width: 30rpx;
						height: 30rpx;

					}
					.tiji{
						margin-left: auto;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFFFFF;
					}
					.tixian{
						padding: 15rpx 37rpx;
						border-radius: 10rpx;
						border: 2rpx solid #FFFFFF;
						margin-left: 30rpx;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFFFFF;
					}
				}
				.sytwo{
					margin-top: 20rpx;
					display: flex;
					flex-direction: row;
					.yprive{
						font-family: PingFang SC;
						font-weight: 800;
						font-size: 40rpx;
						color: #FFFFFF;
						.ypnum{
							font-size: 50rpx;
						}
					}
					.chizhi{
						margin-left: auto;
						padding: 16rpx 37rpx;
						border-radius: 10rpx;
						border: 2rpx solid #FFFFFF;
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #FFFFFF;
					}
				}
			}
		}
		.ztwo{
			// margin-top: 60rpx;
			.shouname{
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #333333;
				display: block;
				margin-bottom: 20rpx;
			}
			.nlist{
				background: #FFFFFF;
				border-radius: 20rpx;
				padding: 10rpx 30rpx;
				.nitem{
					display: flex;
					padding: 20rpx 0;
					border-bottom: 1rpx solid #eee;
					flex-direction: column;
					.none{
						display: flex;
						flex-direction: row;
						align-items: center;
						.name{
							font-family: PingFang SC;
							font-weight: 500;
							font-size: 30rpx;
							color: #333333;
						}
						.nprice{
							margin-left: auto;
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 26rpx;
							color: red;
						}
					}
					.time{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 22rpx;
						color: #999999;
						display: block;
						margin-top: 10rpx;
					}
				}
			}
		}
	}
	
</style>
